package com.gis.visualization.controller;


import com.gis.visualization.config.result.R;
import com.gis.visualization.entity.HunanCity;
import com.gis.visualization.service.HunanCityService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author hqz
 * @since 2021-03-15
 */
@RestController
@RequestMapping("/visualization/hunancity")
public class HunanCityController {
    @Autowired
    private HunanCityService cityService;

    @ApiOperation("获取湖南的地级市")
    @GetMapping("getCities")
    @Cacheable(value = "cities",key = "'selectCity'")
    public R getCities() {
        List<HunanCity> cities = cityService.list(null);
        return R.ok().data("cities",cities);
    }

}

